package com.dragon.repository.domain.dto;

import com.dragon.common.util.BeanUtils;
import com.dragon.repository.entity.ExamineUser;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;


/**
 * @author sy
 */
@Data
@JsonInclude(JsonInclude.Include.NON_NULL)
public class ExamineUserDTO {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "主键id")
    private Integer id;

    @ApiModelProperty(value = "审核主表id")
    private Integer examineId;

    @ApiModelProperty(value = "当前审核人id")
    private Integer auditUserId;

    @ApiModelProperty(value = "审核状态：0：待审核，1：同意，2：拒绝")
    private Integer status;

    @ApiModelProperty(value = "上一审核状态：0，未审核，1、同意，2，不同意")
    private Integer preStatus;

//    @ApiModelProperty(value = "审核类型：0，审核，1、反审核")
//    private Integer examineType;

    @ApiModelProperty(value = "意见")
    private String opinion;

    @ApiModelProperty(value = "添加时间")
    private Date createTime;

    @ApiModelProperty(value = "修改时间")
    private Date updateTime;

    @ApiModelProperty(value = "审核时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date auditTime;


    public ExamineUserDTO() {}

    public ExamineUserDTO(ExamineUser entity) {
        BeanUtils.copyProperties(entity,this);
    }

    public static ExamineUserDTO convert(ExamineUser entity) {
        return new ExamineUserDTO(entity);
    }

    public static List<ExamineUserDTO> convertList(List<ExamineUser> list) {
        List<ExamineUserDTO> resultList = new ArrayList<>();
        for (ExamineUser entity : list) {
            resultList.add(new ExamineUserDTO(entity));
        }
        return resultList;
    }}
